package com.leyou.service;

import com.leyou.dao.Spec_groupMapper;
import com.leyou.dao.Spec_paramMapper;
import com.leyou.pojo.Spec_group;
import com.leyou.pojo.Spec_param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class Spec_groupService {
    @Autowired
    private Spec_paramMapper spec_paramMapper;
    @Autowired
    private Spec_groupMapper spec_groupMapper;
    public List<Spec_group> groups(Integer cid) {
        List<Spec_group>list=  spec_groupMapper.groups(cid);
        return list;
    }

    public void add(Spec_group spec_group) {
        spec_groupMapper.insert(spec_group);
    }

    public void update(Spec_group spec_group) {
        spec_groupMapper.updateByPrimaryKey(spec_group);
    }

    public void delete(Integer id) {
        spec_groupMapper.deleteByPrimaryKey(id);
    }

    public List<Spec_param> params(Integer gid) {
        List<Spec_param> list= spec_paramMapper.params(gid);
        return list;
    }

    public void deleteParam(Integer id) {
        spec_paramMapper.deleteByPrimaryKey(id);
    }

    public void addParam(Spec_param spec_param) {
        spec_paramMapper.insertSelective(spec_param);
    }

    public void updateParam(Spec_param spec_param) {
        spec_paramMapper.updateByPrimaryKeySelective(spec_param);
    }

    public List<Spec_param> getParams(Integer cid) {
        List<Spec_param>list=spec_paramMapper.selectByCid(cid);
        return list;
    }

    public List<Spec_param> getParamsq(Integer cid) {
        List<Spec_param>list=spec_paramMapper.selectByCidAndSearching(cid);
        return list;
    }

    public List<Spec_param> fingParamByCidAndGeneric(Integer cid) {
        List<Spec_param>list= spec_paramMapper.fingParamByCidAndGeneric(cid);
        return list;
    }
}
